   /* 
	 <div class="inner" id="inner">
	    <ul class="ul" id="ul">
	      <li class="li"><img src="http://sm.dx0851.com/images/banner.jpg"/></li>
		    <li class="li"><img src="http://sm.dx0851.com/images/huizhen.jpg"/></li>
		    <li class="li"><img src="http://sm.dx0851.com/images/banner1.jpg"/></li>
	    </ul>
	  </div>
		<script>
			swiper({
				move:"inner",
				ul:"ul",
				autoplay:true
			})
		</script>
*/
/*滑动样式*/
document.writeln("  <style>");
document.writeln("    *{");
document.writeln("	  margin: 0 ;");
document.writeln("	  padding: 0;");
document.writeln("	}");
document.writeln("	.inner{");
document.writeln("	  width:100%;");
document.writeln("	  max-width:640px;");
document.writeln("	  margin: 0 auto;");
document.writeln("	  overflow:hidden;");
document.writeln("	}");
document.writeln("	.li{");
document.writeln("	  float:left;");
document.writeln("	  list-style:none");
document.writeln("	}");
document.writeln("	.li img{");
document.writeln("	   width:100%");
document.writeln("	}");
document.writeln("	.ul{");
document.writeln("	   overflow:hidden;");
document.writeln("	   position:relative;");
document.writeln("	}");
document.writeln("  </style>");


	var swiper = function(a){
	  a = a||{}
	  var move = $(a.move)
	  var ul = $(a.ul)
	  var li = ul.children
	  var firstLi = ul.children[0]
	  var ss = 0
 	  /*滑动要用的*/
	  var left = 0
	  var len = 0
	  
	  /*设置自适应宽度*/
	  ul.style.width = 100*(ul.children.length+1)+"%"
	  var liLen = ul.offsetWidth/(ul.children.length+1)
	  var liWidth = liLen+"px"
	  for(var i=0;i<li.length;i++){
	      li[i].style.width = liWidth
	  }
	  
	  /*在轮播图的最后把第一张图复制一份*/
	  ul.appendChild(firstLi.cloneNode(true))
	  
	  /*重新设置li的大小*/
	  window.onresize= function(){	  
	    liLen = ul.offsetWidth/(ul.children.length+1)
		liWidth = liLen+"px"
	    for(var i=0;i<li.length;i++){
	      li[i].style.width = liWidth
	    }
	  }
	  
	  move.ontouchstart=function(){
	   clearInterval(autoplay)
	   len = 0
	   var i = []
	   move.ontouchmove=function(e){
	     i.push(e.changedTouches[0].clientX)
		  len = i[0]-i[i.length-1]
		  /*第一张左滑*/
		  if(left==0 && len < 0){
		    left = ul.offsetWidth- liLen
			ul.style.left=-len-left+"px"
		  }
		  /*最后一张右滑*/
		  else if (left == ul.offsetWidth- liLen && len > 0){
		    left = 0
			ul.style.left=-len-left+"px"
		  }
		  ul.style.left=-len-left+"px"
		}
		left = len+left
	   }
	 move.ontouchend= function(){
	    autoplay = setInterval(auto,3000)
	    if(len>liLen/2 && len<liLen){
		 var animate = setInterval(function(){
		    len += 3
			ul.style.left=-len-left+"px"
			if (len>=liLen){
			  len = liLen
		      left = len + left
			  ul.style.left=-left+"px"
		      clearInterval(animate)
		    }
		  },3)
		} 
		else if(len>0 && len<liLen/2){
		 var animate = setInterval(function(){
		    len -= 3
			ul.style.left=-len-left+"px"
			if (len <= 0){
			  len = 0
		      left = len + left
			  ul.style.left=-left+"px"
		      clearInterval(animate)
		    }
		  },3)
		}
		else if(len<-liLen/2 && len > -liLen){
		  var animate = setInterval(function(){
		    len -=3
			ul.style.left=-len-left+"px"
			if(len <= -liLen){
			  len = -liLen
			  left = len + left
			  ul.style.left = -left+"px"
			  clearInterval(animate)
			}
		  },3)
		}
		else if(len>-liLen/2&&len<0){
          var animate = setInterval(function(){
		    len+=3
		    ul.style.left=-len-left+"px"
		    if(len>=0){
			  len = 0
			  left= len+left
			  ul.style.left = -left+"px"
			  clearInterval(animate)
		    }
		  },3)
		}
		/*处理滑动距离超过一张图片的宽度时*/
        else if(len > liLen) {
		  var animate = setInterval(function(){
		    len -= 3
			ul.style.left=-len-left+"px"
			if (len<=liLen){
			  len = liLen
		      left = len + left
			  ul.style.left=-left+"px"
		      clearInterval(animate)
		    }
		  },3)
		}	
        else if(len < -liLen) {
		  var animate = setInterval(function(){
		    len +=3
			ul.style.left=-len-left+"px"
			if(len >= -liLen){
			  len = -liLen
			  left = len + left
			  ul.style.left = -left+"px"
			  clearInterval(animate)
			}
		  },3)
	    }
	}
	
	
  /*自动轮播*/
  if( a.autoplay === true ){
    var auto = function(){
      if(ss == li[0].offsetWidth*(li.length-1)){
	    ss = li[0].offsetWidth
	    left = 0
	  } else {
	    ss += li[0].offsetWidth
	    left = ss - li[0].offsetWidth
	  }
      animate(ss)
    }
    function animate(ss){
      var startIntv = setInterval(
	    function(){
	      if(left >= ss){
		    clearInterval(startIntv)
		  }else{
		    left+=5
		    ul.style.left=-left+"px"
		  }
	    },3)
    }
	
    var autoplay = setInterval(auto,3000)
	
    move.onmouseover=function(){
	  clearInterval(autoplay)
    }
	
    move.onmouseleave=function(){
      autoplay = setInterval(auto,3000)
     }
 }
	/*获取dom*/
    function $(id){
	  return document.getElementById(id)
	}
 }